package com.zkj.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zkj.dto.DishPageQueryDTO;
import com.zkj.entity.Dish;
import com.zkj.entity.DishFlavor;
import com.zkj.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
public interface DishMapper extends BaseMapper<Dish>  {

    /**
     * 根据分类id查询菜品信息
     * @param categoryId
     * @return
     */
    List<DishVO> selectListInfo(Long categoryId);

    /**
     * 根据分类id查询菜品数量
     * @param categoryId
     * @return
     */
    @Select("select count(id) from dish where category_id = #{categoryId}")
    Integer countByCategoryId(Long categoryId);


    // 返回值返回 Ipage<Entity> 第一个参数为 Page负责分页的对象 第二个参数为查询条件
    IPage<DishVO> queryPageListPaging(Page<DishVO> page,
                                     @Param("dish") DishPageQueryDTO dishPageQueryDTO);

    List<Dish> list(Dish dish);

}
